package com.lzy.cloud.order.service.impl;

import com.lzy.cloud.order.dtos.OrderAssessContentDto;
import com.lzy.cloud.order.dtos.OrderInsuranceHolderDto;
import com.lzy.cloud.order.entity.OrderInsuranceHolder;
import com.lzy.cloud.order.mapper.OrderInsuranceHolderMapperExt;
import com.lzy.cloud.order.service.OrderInsuranceHolderService;
import com.lzy.framework.core.utils.DozerUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @description:订单保险投保人信息
 * @author: liyun
 * @create: 2018-07-06 16:26
 */
@Service
public class OrderInsuranceHolderServiceImpl implements OrderInsuranceHolderService {
    @Autowired
    private OrderInsuranceHolderMapperExt orderInsuranceHolderMapperExt;

    @Override
    public List<OrderInsuranceHolderDto> queryListByOrderId(String orderId) {
        return orderInsuranceHolderMapperExt.queryListByOrderId(orderId);
    }

    @Override
    public Long create(OrderInsuranceHolderDto orderInsuranceHolderDto) {
        OrderInsuranceHolder orderInsuranceHolder = DozerUtils.map(orderInsuranceHolderDto, OrderInsuranceHolder.class);
        return orderInsuranceHolderMapperExt.insertSelective(orderInsuranceHolder) > 0 ? orderInsuranceHolder.getId() : 0L;
    }
}
